using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.IO;
using System.Data.OleDb;

namespace MaskData
{
	public class ImageMaskElement : MaskElement
	{
		private MemoryStream _value;
		public MemoryStream Value
		{
			get
			{
				return _value;
			}
			set
			{
				_value = value;
			}
		}
		public ImageMaskElement(ImageElementType type, MemoryStream value)
			: base(type)
		{
			_value = value;
		}
		public override bool SaveToRow(DataRow row)
		{
			if (_value != null)
			{
				byte[] imagedata = _value.ToArray();
				row[_type.FieldName] = imagedata;
			}
			else
			{
				row[_type.FieldName] = null;
			}
			return true;
		}
		//public override OleDbType GetDbType()
		//{
		//    return OleDbType.VarBinary;
		//}
	}
}
